package com.tar.system.sys.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.tar.system.sys.dao.JdbcAccountDao;

@Repository
public class JdbcAccountDaoImpl implements JdbcAccountDao {
	
	@Autowired
	private JdbcTemplate jdbcTemplate ;

	@Override
	public void outMoney(String out, Double money) {
		String sql = "update tar_sys_account set money = money - ? where name = ?" ;
		this.jdbcTemplate.update(sql, money, out) ;
	}

	@Override
	public void inMoney(String in, Double money) {
		String sql = "update tar_sys_account set money = money + ? where name = ?" ;
		this.jdbcTemplate.update(sql, money, in) ;
	}

}
